package com.qianyan.servlet;

import org.apache.catalina.websocket.WebSocketServlet;
import javax.servlet.http.HttpServletRequest;
import org.apache.catalina.websocket.StreamInbound;

import com.qianyan.websocket.WebSocketMessageInbound;

public class SendMessageServlet extends WebSocketServlet {

	private static final long serialVersionUID = 1L;
	
	public static int ONLINE_USER_COUNT	= 1;//上线人数
	
	public String getUser(HttpServletRequest request){
		return (String) request.getSession().getAttribute("user");
	}

    @Override
    protected StreamInbound createWebSocketInbound(String subProtocol,HttpServletRequest request) {
        return new WebSocketMessageInbound(this.getUser(request));
    }
}